//
//  JMFormSectionDescriptor.h
//  SYPerfectDemo
//
//  Created by Lssyyy on 2019/7/31.
//  Copyright © 2019年 Lssyyy. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "JMFormRowDescriptor.h"
#import "JMFormDescriptor.h"
typedef NS_OPTIONS(NSUInteger, JMFormSectionOptions) {
    JMFormSectionOptionNone        = 0,
    JMFormSectionOptionCanInsert   = 1 << 0,
    JMFormSectionOptionCanDelete   = 1 << 1,
    JMFormSectionOptionCanReorder  = 1 << 2
};

typedef NS_ENUM(NSUInteger, JMFormSectionInsertMode) {
    JMFormSectionInsertModeLastRow = 0,
    JMFormSectionInsertModeButton = 2
};
@class JMFormDescriptor;
@interface JMFormSectionDescriptor : NSObject
@property (nonatomic, nullable) NSString * title;
@property (nonatomic, nullable) NSString * footerTitle;
@property (readonly, nonnull) NSMutableArray * formRows;

@property (readonly) JMFormSectionInsertMode sectionInsertMode;
@property (readonly) JMFormSectionOptions sectionOptions;
@property (nullable) JMFormRowDescriptor * multivaluedRowTemplate;
@property (readonly, nullable) JMFormRowDescriptor * multivaluedAddButton;
@property (nonatomic, nullable) NSString * multivaluedTag;

@property (weak, null_unspecified) JMFormDescriptor * formDescriptor;

@property (nonnull) id hidden;

+(nonnull instancetype)formSection;
+(nonnull instancetype)formSectionWithTitle:(nullable NSString *)title;
+(nonnull instancetype)formSectionWithTitle:(nullable NSString *)title sectionOptions:(JMFormSectionOptions)sectionOptions;
+(nonnull instancetype)formSectionWithTitle:(nullable NSString *)title sectionOptions:(JMFormSectionOptions)sectionOptions sectionInsertMode:(JMFormSectionInsertMode)sectionInsertMode;

-(void)addFormRow:(nonnull JMFormRowDescriptor *)formRow;
-(void)addFormRow:(nonnull JMFormRowDescriptor *)formRow afterRow:(nonnull JMFormRowDescriptor *)afterRow;
-(void)addFormRow:(nonnull JMFormRowDescriptor *)formRow beforeRow:(nonnull JMFormRowDescriptor *)beforeRow;
-(void)removeFormRowAtIndex:(NSUInteger)index;
-(void)removeFormRow:(nonnull JMFormRowDescriptor *)formRow;

-(BOOL)isMultivaluedSection;
@end
